import httpx
from celery import Celery, signals
from app.core.config import settings


def make_celery():
    app = Celery(
        "tasks",
        broker=settings.CELERY_BROKER,
        backend=settings.CELERY_BACKEND,
    )
    # 配置任务状态跟踪
    app.conf.task_track_started = True

    return app

@signals.task_success.connect
def task_success_handler(sender=None, result=None, **kwargs):
    task_id = sender.request.id
    task_name = sender.name if sender else None





@signals.task_failure.connect
def task_failure_handler(sender=None, exception=None, **kwargs):


    print("===========")